package ab.mes.service.impl;

import ab.mes.entity.Material;
import ab.mes.mapper.MaterialMapper;
import ab.mes.service.MaterialService;
import ab.mes.tools.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MaterialServiceImpl implements MaterialService {
    @Autowired
    private MaterialMapper materialMapper;
    //获取一页物料信息
    public Result getMaterial(){
        Result result = new Result();
        result.getMap().put("material",materialMapper.selectMaterial1());
        return result;
    }
    //根据页数获取物料信息
    public Result getMaterialByNumber(Integer id_Of_Material){
        Result result = new Result();
        result.getMap().put("material",materialMapper.selectByNumber(id_Of_Material));
        return result;
    }
    //新增物料信息
    public Result insertMaterial(Material material) {
        Result result = new Result();
        result.getMap().put("material",materialMapper.insertMaterial(material));
        return result;
    }
    //根据id删除物料信息
    public Result deleteMaterial(Integer id_Of_Material) {
        Result result = new Result();
        result.getMap().put("material", materialMapper.deleteMaterial(id_Of_Material));
        return result;
    }
    //修改物料信息
    public Result editMaterial(Material material){
        Result result = new Result();
        result.getMap().put("material",materialMapper.editMaterial(material));
        return result;
    }
}
